﻿using System.Diagnostics;

namespace DimensionsHelper.LanguageService.Syntax;

public class SourceString : PreExpression
{
    internal SourceString(SourceNode? parent) : base(parent, SyntaxKinds.String)
    {
    }
}


public static partial class NodeFactory
{
    public static SourceString CreateSourceString(SourceNode? parent, int position)
    {
        SourceString strNode = new(parent);
        strNode.Update(position);
        return strNode;
    }

    public static SourceString CreateSourceString(SourceNode? parent)
    {
        return new SourceString(parent);
    }


    public static SourceString CreateSourceString(SourceNode? parent, int start, int length, string text)
    {
        SourceString str = new(parent);
        str.Update(start, length, text);
        return str;
    }

    public static SourceString CreateSourceStringFrom(SourceNode source)
    {
        Debug.Assert(source.IsNode(SyntaxKinds.String));
        SourceString strNode = new(null);
        strNode.UpdateFrom(source);
        strNode.SetFlags(source.GetFlags());
        return strNode;
    }
}